package com.woniuxy.enjoylife.mapper;

import com.woniuxy.enjoylife.entity.Community;
import com.woniuxy.enjoylife.entity.dto.ActivityCommentAndUserDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CommunityMapper {
    //判断小区是否存在
    public Community isCertification(String name);

    //物业查看本小区，通过小区去查活动
    public Community findCommunityByWid(int wid);

    //通过小区名查询小区是否已存在
    public Community haveCommunityByName(String name);

    //通过小区名查询小区是否被认证
    public Community communityIsAttestation(String name);

    //通过用户id查询是否注册过小区物业
    public Community findByUserId(int wid);

    //通过小区名查询小区id
    public int findIdByName(String name);

    //物业用户注册(添加信息)
    public int registerProperty(@Param("name") String name,@Param("wid") int wid);
    //物业用户注册(通过id，修改wid)
    public int registerPropertyById(@Param("id") int id,@Param("wid") int wid);

    //根据活动cid查询小区的名字
    public Community findNameByCid(int id);

    //*********************用户查询房屋对应小区********
    //查询房屋对应的小区
    public List<Community> findUserCommunity(int uid);
    //通过小区id查询相关物业
    public int findWidById(int id);



    //根据用户id查询默认房屋对应小区
    public int findDefCommunity(int uid);
}
